package com.xspace.android.xafcommon.network.task;

import java.util.Date;

import android.content.Context;

import com.xspace.android.xafcommon.network.message.IRequestMsg;
import com.xspace.android.xafcommon.network.message.IResponseMsg;


public abstract class Task implements ITask 
{
    protected int taskState=ITask.TASKSTATE_READY;
    //Task's Listener
    private ITaskListener listener = null;
    public Boolean isBackgroud = false;
    
    //Task request After launching the task will be callback interface to get the network layer send data
    private IRequestMsg requestMsg = null;
    
    //The response fo the task,to accept the network layer to return to the data
    private IResponseMsg responseMsg = null;
    
    private int mTaskId;

    public Task(IRequestMsg requestMsg, IResponseMsg responseMsg, ITaskListener listener)
    {
        super();
        this.listener = listener;
        this.requestMsg = requestMsg;
        this.responseMsg = responseMsg;
    }

    public Task(String downloadURL,IRequestMsg requestMsg, IResponseMsg responseMsg, ITaskListener listener)
    {
        super();
        this.listener = listener;
        this.requestMsg = requestMsg;
        this.responseMsg = responseMsg;
    }
    public IRequestMsg getRequest() 
    {
        // TODO Auto-generated method stub
        return requestMsg;
    }

    public IResponseMsg getResponse() 
    {
        // TODO Auto-generated method stub
        return responseMsg;
    }

    public ITaskListener getListener() 
    {
        // TODO Auto-generated method stub
        return listener;
    }

    public Context getContext() 
    {
        // TODO Auto-generated method stub
        return null;
    }

    public int getTaskState() 
    {
        // TODO Auto-generated method stub
        return taskState;
    }

    public void setTaskId(int taskId) 
    {
        // TODO Auto-generated method stub
        this.mTaskId = taskId;
    }

    
    public int getTaskId() 
    {
        // TODO Auto-generated method stub
        return this.mTaskId;
    }

    
    private Date mSubmitTime;
    private Date mBeginExceuteTime;
    private Date mFinishTime;
    
    public void setSubmitTime(Date date) 
    {
        // TODO Auto-generated method stub
        this.mSubmitTime = date;
    }

    public Date getBeginExceuteTime() {
        // TODO Auto-generated method stub
        return this.mBeginExceuteTime;
    }

    public Date getFinishTime() {
        // TODO Auto-generated method stub
        return this.mFinishTime;
    }

    public void setBeginExceuteTime(Date date) {
        // TODO Auto-generated method stub
        this.mBeginExceuteTime = date;
    }

    public void setFinishTime(Date date) {
        // TODO Auto-generated method stub
        this.mFinishTime = date;
    }
    
}
